package com.test.mysql;

import cn.hutool.core.bean.BeanUtil;
import com.test.db.api.UserDao;
import com.test.db.api.entity.User;
import com.test.mysql.entity.MyUser;
import com.test.mysql.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

@Service
@ConditionalOnProperty(name = "common.db", havingValue = "mysql")
public class MUserDAO implements UserDao {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User getInfo() {
        MyUser user = userMapper.selectById(1);
        return BeanUtil.toBean(user, User.class);
    }
}
